# import tkinter as tk
# window = tk.Tk()
# window.title('hello thinter')
# height= window.winfo_screenheight()
# width= window.winfo_screenwidth()
# window.geometry('400x300+%d+%d'%((width-400)/2,(height-300)/2))
# text = tk.Text(window,width=20,height=10)
# text.pack()
# window.mainloop()


# 获取文本框内容
import tkinter as tk

# def A():
#     param = text.get("1.0","end")
#     print("选中的值",param)

# window = tk.Tk()
# window.title('hello thinter')
# height= window.winfo_screenheight()
# width= window.winfo_screenwidth()
# window.geometry('400x300+%d+%d'%((width-400)/2,(height-300)/2))
# text = tk.Text(window,width=20,height=10)
# text.pack()

# tk.Button(window,text="获取文本值",command=A).pack()
# window.mainloop()


# 插入
def A():
    param = text.get("1.0","end")
    print("选中的值",param)


def B():
    param = text.delete("1.0","end")
    
window = tk.Tk()
window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x300+%d+%d'%((width-400)/2,(height-300)/2))
text = tk.Text(window,width=20,height=10)
#在光标车插入数据
text.insert("insert", "你好啊")
#在最后插入数据
text.insert("end", "你好啊")
text.pack()

tk.Button(window,text="获取文本值",command=A).pack()



tk.Button(window,text="删除内容",command=B).pack()
window.mainloop()